package com.qf.controller;

import cn.hutool.http.HttpUtil;
import com.qf.feign.BaiduClent;
import com.qf.feign.NginxClient;
import com.qf.feign.ProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FeignController {

    @Autowired
    ProviderClient providerClient;

    @Autowired
    BaiduClent baiduClent;

    @Autowired
    NginxClient nginxClient;

    @GetMapping("/ngxin")
    public String ngxin(){
        String result = nginxClient.test1();
        return result;
    }

    @GetMapping("/hutool")
    public String hutool(String s){
        String url = "https://www.baidu.com:443/s?wd=onepiece&tn=json";
        String result = HttpUtil.get(url);
        return result;
    }

    @GetMapping("/search")
    public String search(String s){
        String result = baiduClent.search(s,"json");
        return result;
    }

    @GetMapping("/test1")
    public String test1(@RequestParam("s") String s){
        String echo = providerClient.echo(s);
        return echo;
    }
}
